import cv2
import numpy as np

def cv_show(name,img):
    cv2.imshow(name,img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

img = cv2.imread('C:/Users/nic/Desktop/opencv/picture/documents/ticket.png')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#检测图像中的变化幅度
dst = cv2.cornerHarris(gray,2,3,0.04)
print(img.shape)
print(dst.shape)
#当某个点变化幅度大于最大值的某个倍数时，给这个点标记为红色
img[dst>0.1*dst.max()] = [0,0,255]
cv_show('corner',img)



